#!/bin/bash
export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch.
#export SDL_VIDEO_CENTERED=1    # Centre the screen.  Messes up resizing.

pkgname=dwarffortress #To be set by PKGBUILD

if [[ ! -d "$HOME/.$pkgname" ]]; then
    mkdir -p "$HOME/.$pkgname/data"
    ln -s /opt/"$pkgname"/raw "$HOME/.$pkgname/raw"
    ln -s /opt/"$pkgname"/libs "$HOME/.$pkgname/libs"
    cp -rn /opt/"$pkgname"/data/init "$HOME/.$pkgname/data/init"
fi

for link in announcement art dipscript help index initial_movies movies shader.fs shader.vs sound speech; do
    cp -ru /opt/"$pkgname"/data/$link -t "$HOME/.$pkgname/data/"
done

cd "$HOME/.$pkgname"
exec ./libs/Dwarf_Fortress "$@"

